{{extend 'layout.html'}}
{{keys={} }}
{{for tag in tags:}}{{if '/' in tag.name:}}{{prefix=tag.name.split('/')[0]}}{{keys[prefix]=keys.get(prefix,[])+[tag]}}{{pass}}{{pass}}

<h1>Search by Tags</h1>

<ul data-role="listview"  data-inset="true">
  {{for prefix in sorted(keys):}}
  <li><a href="{{=URL('search2',vars=dict(prefix=prefix))}}">{{=prefix}}</a></li>
  {{pass}}
  {{for tag in tags:}}{{if not '/' in tag.name:}}
  <li><a href="{{=URL('bytag',vars=dict(tag=tag.name))}}">{{=tag.name}}</a></li>
  {{pass}}
  {{pass}}
</ul>
